package a2;
public class A2Constraints {

	private int cellWidth, cellHeight;
	private int xPos, yPos;
	
	/**
	 * Construct a set of default constraints, which denote a 1x1 object at x,y
	 * @param x Column that the Item will occupy.
	 * @param y Row that the item will occupy.
	 */
	public A2Constraints(int x, int y)
	{		
		this(x, y, 1, 1); 
	}
	
	/**
	 * Constructs a set of constraints for a component.
	 * @param x Column the component will occupy.
	 * @param y Row the component will occupy.
	 * @param width The number of grid spaces that the width of the component requires.
	 * @param height The number of grid spaces that the height of the component requires.
	 */
	public A2Constraints(int x, int y, int width, int height)
	{
		this.xPos = x;
		this.yPos = y;
		this.cellWidth = width;
		this.cellHeight = height;
	}

	/**
	 * Sets the width of the constraint to w.
	 * @param w Width of the constraint.
	 */
	public void setWidth(int w)
	{
		this.cellWidth = w;
	}
	/**
	 * Sets the height of the constraint to h.
	 * @param h Height of the constraint.
	 */
	public void setHeight(int h)
	{
		this.cellHeight = h;
	}
	/**
	 * Sets the row the constraint will denote.
	 * @param y The row for the constraint.
	 */
	public void setYPos(int y)
	{
		this.yPos = y;
	}
	/**
	 * Sets the column of the constraint.
	 * @param x The column for the constraint.
	 */
	public void setXPos(int x)
	{
		this.xPos = x;
	}
	/**
	 * @return The row specified by the constraint.
	 */
	public int yPos()
	{
		return this.yPos;
	}
	/**
	 * @return The column specified by the constraint.
	 */
	public int xPos()
	{
		return this.xPos;
	}
	/**
	 * @return The number of cells required by the width.
	 */
	public int width()
	{
		return this.cellWidth;
	}
	/**
	 * @return The number of cells required by the height.
	 */
	public int height()
	{
		return this.cellHeight;
	}
}
